<!-- 库房管理-删除按钮组件 -->
<script lang="ts">
import { reactive, inject } from "vue";
import { errorMessage, successMessage } from "/@/utils/message";
import { VXETable } from "vxe-table";
import { deleteBill } from "/@/api/log/interfaceLog";
import { useRoute } from "vue-router";

export default {
  name: "finishOrder",
  props: {
    billType: {
      type: String,
      default: ""
    },
    bnoNo: {
      type: String,
      default: ""
    },
    billTypeStr: {
      type: String,
      default: ""
    }
  },
  setup(props, ctx) {
    const route = useRoute();
    const routeName = route.name as string;
    const detailDialog = reactive({
      receiptsType: "", //单据类型
      disabled: false,
      detailId: 0 //详情ID
    });
    const subItemData = inject("subItemData") as any;
    console.log(subItemData);
    // (row.bnoNo)
    // 删除单据
    const deleteData = async () => {
      const type = await VXETable.modal.confirm("您确定要删除该数据?");
      if (type === "confirm") {
        deleteBill(props.billType, props.bnoNo, props.billTypeStr).then(
          (res: any) => {
            if (res.code === 0) {
              successMessage("删除成功");
              ctx.emit("close");
            } else {
              errorMessage(res.message);
            }
          }
        );
      }
    };
    return { detailDialog, deleteData, routeName };
  }
};
</script>
<template>
  <vxe-button
    type="text"
    icon="fa fa-trash-o"
    v-auth="routeName + ':delete'"
    @click="deleteData"
    >删除</vxe-button
  >
</template>
<style>
.mytable-style .vxe-body--column.col-blue {
  background-color: #60b8ff;
  color: #fff;
}
.mytable-style .vxe-body--column.col-orange {
  background-color: #f56c6c;
  color: #fff;
}
</style>
<style lang="scss" scoped>
.vxe-input + .vxe-button,
.vxe-input + .vxe-button--dropdown,
.vxe-button + .vxe-button,
.vxe-button + .vxe-button--dropdown {
  margin-left: 0;
}

.vxe-toolbar.size--medium {
  padding: 10px;
}

.vxe-table--render-default.size--medium {
  margin-top: 12px;
}

.vxe-button.size--medium.type--button {
  margin-left: 1em;
  height: 32px;
}

.text-model {
  &:hover {
    cursor: pointer;
  }
}
:deep(div.storageDialog) {
  height: 60%;
  overflow: hidden;
}
:deep(div.storageDialog .el-dialog__body) {
  position: absolute;
  left: 0;
  top: 54px;
  bottom: 65px;
  right: 0;
  z-index: 1;
  overflow: hidden;
  overflow-y: auto;
}
:deep(div.storageDialog .el-dialog__footer) {
  position: absolute;
  bottom: 3px;
  right: 0;
}
:deep(.btnClass) {
  color: rgb(64, 158, 255);
  font-weight: bold;
}
:deep(.menuClass) {
  color: #606266;
  font-weight: bold;
}
</style>
